package com.xt.purchasingsystem.controller.stockManagement;

import com.xt.purchasingsystem.dto.SGatherDto;
import com.xt.purchasingsystem.dto.SPayDto;
import com.xt.purchasingsystem.service.stockManagementService.InAndOutWarehouseManageService;
import com.xt.purchasingsystem.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 库存管理-->出入库调度管理所有接口
 * @author: 老姚
 * Date:  2020/5/28 11:20
 */
@RestController
@RequestMapping(value = "/inAndOutWarehouseManagement")
public class InAndOutWarehouseManagementController {
    @Autowired
    private InAndOutWarehouseManageService inAndOutWarehouseManageService;

    /**
     * 多条件分页查询所有已审核的入库申请单及其明细的接口
     *
     * @param sGatherDto
     * @return
     */
    @PostMapping("/getAllIsCheckSgatherByPage")
    public Result getAllIsCheckSgatherByPage(@RequestBody SGatherDto sGatherDto) {
        return inAndOutWarehouseManageService.getAllIsCheckSgatherByPage(sGatherDto);
    }

    /**
     * 根据产品编号查询此产品库存单元的接口
     * @param productId
     * @return
     */
    @GetMapping("/getScellByProductId/{productId}")
    public Result getScellByProductId(@PathVariable String productId){
        return inAndOutWarehouseManageService.getScellByProductId(productId);
    }

    /**
     * 入库调度的接口
     * @param sGatherDto
     * @return
     */
    @PostMapping("/operationDispatching")
    public Result operationDispatching(@RequestBody SGatherDto sGatherDto){
        return inAndOutWarehouseManageService.operationDispatching( sGatherDto);
    }

    /**
     * 多条件分页查询所有已审核未调度的出库申请单及其明细的接口
     *
     * @param sPayDto
     * @return
     */
    @PostMapping("/getAllIsCheckSPayByPage")
    public Result getAllIsCheckSPayByPage(@RequestBody SPayDto sPayDto) {
        return inAndOutWarehouseManageService.getAllIsCheckSPayByPage(sPayDto);
    }
    /**
     * 出库调度的接口
     * @param sPayDto
     * @return
     */
    @PostMapping("/deliverySchedule")
    public Result deliverySchedule(@RequestBody SPayDto sPayDto){
        return inAndOutWarehouseManageService.deliverySchedule( sPayDto);
    }

}
